package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.dto.PageDTO;
import com.zzyl.nursing.dto.UserLoginRequestDto;
import com.zzyl.nursing.service.IFamilyMemberService;
import com.zzyl.nursing.vo.LoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 老人家属Controller
 *
 * @author ruoyi
 * @date 2024-09-02
 */
@RestController
@RequestMapping("/member")
@Api(tags =  "老人家属相关接口")
public class FamilyMemberController extends BaseController
{
    @Autowired
    private IFamilyMemberService familyMemberService;

    @PostMapping("/user/login")
    @ApiOperation("小程序登录")
    public AjaxResult login(@RequestBody UserLoginRequestDto userLoginRequestDto) {
        LoginVo loginVo = familyMemberService.login(userLoginRequestDto);
        return success(loginVo);
    }

    /**
     * 分页查询所有护理项目
     * @param pageDTO
     * @return
     */
    @GetMapping("/orders/project/page")
    public TableDataInfo<NursingProject> getAllNursingProject(PageDTO pageDTO){
        return getDataTable(familyMemberService.getAllNursingProject(pageDTO));
    }

    /**
     * 获取某个护理项目的信息
     * @param
     * @return
     */
    @GetMapping("/orders/project/{id}")
    public R<NursingProject> getNursingProjectById(@PathVariable Long id){
        return R.ok(familyMemberService.getNursingProjectById(id));
    }

//    //http://localhost:8080/member/orders/order/page?pageSize=10&pageNum=1&status=
//    @GetMapping("/orders/order/page")
//    public TableDataInfo getOrderList(@RequestParam Integer status){
//        startPage();
//        return getDataTable(familyMemberService.getOrderList(status));
//    }

}